Skip to content

Conversation

@roomote
Copy link
Collaborator

@roomote roomote commented Jun 30, 2025

Summary

This PR fixes issue #5139 where users were experiencing YAML parsing errors in .roomodes files after updating to v3.22.0, specifically addressing problems with line number extraction from YAML error messages.

Problem

Users reported getting generic error messages like:

Invalid YAML format on line 7 of the .roomodes file. Please check: • Correct indentation (use spaces, not tabs) • Matching quotes and brackets • Valid YAML syntax

The issue was that the line number extraction logic in CustomModesManager was only looking for one specific error message format pattern, but the YAML library can produce different error message formats.

Solution

Enhanced the line number extraction logic in src/core/config/CustomModesManager.ts to handle multiple YAML error message formats:

  • at line X - Original pattern
  • line X - Alternative pattern
  • (line:column) - Parenthesized format
  • line:column - Direct format

The fix tries multiple regex patterns in order and uses the first match found, falling back to 'unknown' if no line number can be extracted.

Changes

  • Improved parseYamlSafely() method in CustomModesManager to use multiple line number extraction patterns
  • Maintains backward compatibility with existing error handling
  • Ensures robust error reporting for .roomodes files with YAML syntax errors

Testing

  • Verified that the enhanced regex patterns correctly extract line numbers from various YAML error message formats
  • Confirmed that existing functionality remains unchanged
  • All linting and type checking passes

Fixes #5139


Important

Improves line number extraction from YAML error messages in CustomModesManager.ts to handle multiple formats for better error reporting in .roomodes files.

  • Behavior:
    • Enhanced line number extraction in parseYamlSafely() in CustomModesManager.ts to handle multiple YAML error message formats.
    • Supports patterns: at line X, line X, (line:column), and line:column.
    • Falls back to 'unknown' if no line number is extracted.
  • Testing:
    • Verified regex patterns extract line numbers from various YAML error formats.
    • Confirmed no changes to existing functionality.
    • All linting and type checks pass.

This description was created by Ellipsis for 445cd63. You can customize this summary. It will automatically update as commits are pushed.

…files

- Enhanced line number extraction in CustomModesManager to handle multiple YAML error message formats
- Added support for patterns: 'at line X', 'line X', '(line:column)', and 'line:column'
- Ensures robust error reporting when .roomodes files have YAML syntax errors
- Maintains backward compatibility with existing error handling
@roomote roomote requested review from cte, jr and mrubens as code owners June 30, 2025 07:59
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 30, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jun 30, 2025

No security or compliance issues detected. Reviewed everything up to 445cd63.

Security Overview
  • 🔎 Scanned files: 1 changed file(s)
Detected Code Changes

The diff is too large to display a summary of code changes.

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 7, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

After updating to v3.22.0, the previous .roomodes report an invalid YAML format error.

3 participants